import CONSTANT from '@/common/constants.js'
import http from '@/common/http.js'

import Flexbox from 'vux/src/components/flexbox/flexbox.vue'
import FlexboxItem from 'vux/src/components/flexbox/flexbox-item.vue'
import XProgress from 'vux/src/components/x-progress/index.vue'

export default {
  name: 'donateareadetails',
  components: {
    Flexbox,
    FlexboxItem,
    XProgress
  },
  data () {
    return {
      areaid: '',
      pageNo: 1,
      pageSize: 5,
      details:{},
      donateList:[],
    }
  },
  mounted () {
    this.areaid = this.$route.query.areaid
    this.init()
  },
  methods: {
    init: function () {
      let _this=this;
      http.post(CONSTANT.DONATES_BY_AREAID, {
        areaId: this.areaid,
        pageNo: this.pageNo,
        pageSize: this.pageSize
      }, (res) => {
        if (res.code == 200) {
          _this.donateList=res.list;
        }
      });

      http.post(CONSTANT.DONATES_DETAILS, {
        id: this.areaid
      }, (res) => {
        if (res.code == 200) {
          _this.details=res.obj;
        }
      });
    },
    comeBack: function () {
      window.history.go(-1)
    },
    goProjectDetails (eventId) {
      window.sessionStorage.setItem('event_id', eventId)
      this.$router.push({path: '/Project', query: {event_id: eventId}})
    },
    lookMore:function () {
      this.$router.push({path: '/projectlist', query: {donateAreaId: this.areaid}})
    }
  }
}
